<?php

class IndexModule extends BaseModule
{
    function haha()
    {
        $data = array(
            'k1' => 'v1',
            'k2' => 'v2',
        );
        
        return $data;
    }
    
    function db()
    {
        $db_cfg = DbDispatcher::dispatchTable('test_table_tag', '', 'w');
        $ops = array(
            'cfg'    => $db_cfg,
            'no_sql' => true,
        );
        
        $db_op = DbOp::getInstance($ops, array());
        $sql = "select * from {$db_cfg['DBTABLE']}";
        
        $ret = $db_op->query($sql);
        if ($ret === false) {
            trigger_error('execute sql failed, sql ='.$sql, E_USER_ERROR);
            return false;
        }
        
        return $ret;
    }
}